package io.netty.sigar;

import java.rmi.Naming;
import java.rmi.registry.LocateRegistry;

public class SigarMain {
    public static String ip;
    //需要测量CPU、内存、网络使用率 java -jar test.jar 192.168.191.5
    public static void main(String args[]) {
        try {
            System.setProperty("java.library.path", "monitor_libs");
            if(args.length==0) ip = "192.168.191.5";
            else ip = args[0];
            System.setProperty("java.rmi.server.hostname", ip);
            SystemStatusService sss = new SystemStatusServiceImpl();
            LocateRegistry.createRegistry(8828);
            Naming.bind("rmi://"+ip+":8828/systemstatus",sss);
            System.out.println("启动成功！"+System.getProperty("java.library.path"));
        } catch (Exception e) {
            System.out.println("创建远程对象发生异常！"); 
            System.out.println(e);
        }
        

    }
}
